package com.example.admin.controller.ai;

import com.example.ai.service.InterviewScoreService;
import com.example.ai.vo.InterviewScoreVO;
import com.example.common.utils.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/interview/score")
@Api(tags = "AI面试评分接口")
public class Aipingfeng {

    @Autowired
    private InterviewScoreService interviewScoreService;

    @GetMapping("/{candidateId}")
    @ApiOperation("获取面试评分")
    public CommonResult<InterviewScoreVO> getScore(@PathVariable Integer candidateId) {
        InterviewScoreVO score = interviewScoreService.getScore(candidateId);
        if (score == null) {
            return CommonResult.failed("未找到评分记录");
        }
        return CommonResult.success(score);
    }

    @PostMapping("/generate/{candidateId}")
    @ApiOperation("生成面试评分")
    public CommonResult<InterviewScoreVO> generateScore(@PathVariable Integer candidateId) {
        InterviewScoreVO score = interviewScoreService.generateScore(candidateId);
        return CommonResult.success(score);
    }
}